#include "PloygonWidget.h"
#include "ui_PloygonWidget.h"

PloygonWidget::PloygonWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PloygonWidget)
{
    ui->setupUi(this);

    init();
}

PloygonWidget::~PloygonWidget()
{
    delete ui;
}

PW::PLOYGONTYPE PloygonWidget::GetPloygonType()
{
    return pt;
}

void PloygonWidget::init()
{
    on_Button_Rectangle_clicked();
}

void PloygonWidget::on_Button_Rectangle_clicked()
{
    pt = PW::PLOYGONTYPE::RECTANGLE;

    ui->Button_Rectangle->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Rangle_2.png);");
    ui->Button_Ellipose->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Ellipose_1.png);");
    ui->Button_Rhombus->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Rhombus_1.png);");

    emit PloygonTypeChange();
}

void PloygonWidget::on_Button_Ellipose_clicked()
{
    pt = PW::PLOYGONTYPE::ELLIPOSE;

    ui->Button_Rectangle->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Rangle_1.png);");
    ui->Button_Ellipose->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Ellipose_2.png);");
    ui->Button_Rhombus->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Rhombus_1.png);");

    emit PloygonTypeChange();
}

void PloygonWidget::on_Button_Rhombus_clicked()
{
    pt = PW::PLOYGONTYPE::RHOMBUS;

    ui->Button_Rectangle->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Rangle_1.png);");
    ui->Button_Ellipose->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Ellipose_1.png);");
    ui->Button_Rhombus->setStyleSheet("border-image: url(:/Polygon/Resource/Ploygon_Rhombus_2.png);");

    emit PloygonTypeChange();
}
